import React from 'react';

import memo from '../../common/wrapMemo';

import style from './SwitchLayer.module.scss';

const SwitchLayer = memo((props) => {
    const {changeMapInfo, mapInfo} = props;
    const {type} = mapInfo.toJS();

    const changeLayer = () => {
        const changeType = type === 'vec' ? 'img' : 'vec';
        changeMapInfo({type: changeType});
    };

    return (
        <div className={style.switchLayer} onClick={changeLayer}>
            <i className='iconfont icon-base-layer'></i>
        </div>
    )
});

export default SwitchLayer;